package com.hehao.java_basic.design_mode.creational.simpleFactory;

/**
 * @author Damon
 * @date 2023/9/11
 * @time 15:16
 * 图形绘制工厂,根据给定的类型生成实体类对象
 */
public class ShapeFactory {
    public Shape getShape(String shapeType) {
        if (null == shapeType) {
            return null;
        }
        if (shapeType.equalsIgnoreCase("CIRCLE")) {
            return new Circle();
        }
        if (shapeType.equalsIgnoreCase("RECTANGLE")) {
            return new Rectangle();
        }
        return null;
    }
}
